<!--
 * @Descripttion: 评价数据共享配置
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2021-05-11 15:59:51
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-05-21 10:59:15
-->

<template>
  <div class="mainCon">
    <topTitle :titleText="titleText" class="topConStyle"></topTitle>
    <div class="mainConHeader">
      <div class="mainConHeaderContent"></div>
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
        class="commonTab"
      >
        <el-tab-pane
          :label="item.label"
          :name="item.id"
          v-for="item in list"
          :key="item.id"
        ></el-tab-pane>
      </el-tabs>
      <!-- 失活的组件将会被缓存！-->
      <keep-alive>
        <component v-bind:is="currentTabComponent"></component>
      </keep-alive>
    </div>
  </div>
</template>

<script>
import qyEvaluation from './qyEvaluation'
import projectEvaluation from './projectEvaluation'
export default {
  name: 'dataSharingSettings',
  components: {
    qyEvaluation,
    projectEvaluation,
  },
  data() {
    return {
      titleText: '评价数据共享配置',
      activeName: '1',
      list: [
        {
          id: '1',
          label: '企业评价',
        },
        {
          id: '2',
          label: '项目评价',
        },
      ],
      currentTabComponent: 'qyEvaluation',
    }
  },
  created() {
    if (this.$route.query.tab) {
      this.currentTabComponent = this.$route.query.tab
      this.activeName = this.$route.query.tab == 'qyEvaluation' ? '1' : '2'
    }
  },
  methods: {
    //tabs栏切换
    handleClick(tab, event) {
      if (this.activeName == 1) {
        this.currentTabComponent = qyEvaluation
      } else if (this.activeName == 2) {
        this.currentTabComponent = projectEvaluation
      }
    },
  },
}
</script>

<style scoped lang="less">
.mainCon {
  top: 132px;
  padding: 0;
  &Header {
    position: relative;
    &Content {
      position: absolute;
      left: 130px;
      z-index: 100;
      font-size: 12px;
      color: #666666;
    }
  }
  .topConStyle {
    margin: 0 !important;
  }
}
</style>
